import multiprocessing

def test(q):
    q.put('a')
    q.put('b')
    q.put('c')


if __name__ == '__main__':
    q = multiprocessing.Queue()
    p = multiprocessing.Process(target=test, args=(q,))
    p.start()
    p.join()

    print(q.qsize())
    print(q.get())
    print(q.qsize())
    print(q.get())
    print(q.qsize())
    print(q.get())
    print(q.qsize())
    print(q.get(timeout=3))  # 没拿到数据会阻塞等待，timeout则是设置超时时间
